<?php   // $Id: stat_toutes.php 311 2008-10-31 14:00:15Z pcoustillas $ ?>
<?php   
/*Copyright (C) 2003-2004 Guy Hendrickx
Licensed under the terms of the GNU  General Public License:http://www.opensource.org/licenses/gpl-license.php
File Authors: Pierre Coustillas*/

require_once("include/verif.php");
require_once("include/config/common.php");
require_once("include/language/$lang.php");
require_once("include/utils.php");
require_once("include/headers.php");
 
?>
<script type="text/javascript" src="javascripts/confdel.js"></script>

<table class="page" align="center">
	<tr>
		<td class="page" align="center">
			<?php
			require_once("include/head.php");
			?>
		</td>
	</tr>
	<tr>
		<td class="page" align="center">
			<?php

			if ($user_stat=="n") { 
			echo "<h1>$lang_statistique_droit</h1>";
			exit;
			}

			if (isset($_GET['message']))
			{
				echo "<h1>" . stripslashes($_GET['message']) . "</h1>";
			}

			$jour = date("d");
			$mois = date("m");
			$annee = date("Y");

			//tot_art_htva = prix HT d'une ligen de bon de commande 
			$sql = "SELECT total_fact_h,date_fact,client,nom,payement,valide,num FROM ${tblpref}facture

				INNER JOIN ${tblpref}client ON client=num_client";
				//INNER JOIN ${tblpref}article ON article_num=${tblpref}article.num";
				//INNER JOIN ${tblpref}bon_comm ON num=num_facture 
				//INNER JOIN ${tblpref}cont_bon ON num_bon=bon_num 

			// ----------  DEBUT DE GESTION DES FILTRES ---------------------
			if (isset($_GET['annuler_filtre'])) //vidage des filtres si demandé
			{
				$_SESSION['filtre_stat_client'] = "";
				$_SESSION['filtre_stat_date1'] = "";
				$_SESSION['filtre_stat_date2'] = "";

			}

			//$filtre=" WHERE num > 0 AND ";
			$filtre="";

			if (isset($_GET['filtrer']))
			{
				// MAJ des variables de session de filtre si il y a eu demande de filtrage
				if (isset($_GET['filtre_stat_client']) && $_GET['filtre_stat_client']<>0 )
					$_SESSION['filtre_stat_client']=$_GET['filtre_stat_client'];
				if (isset($_GET['filtre_stat_client']) && $_GET['filtre_stat_client']==0 )
					unset($_SESSION['filtre_stat_client']);
				if (isset($_GET['filtre_stat_date1']))
					$_SESSION['filtre_stat_date1']=$_GET['filtre_stat_date1'];
				if (isset($_GET['filtre_stat_date2']))
					$_SESSION['filtre_stat_date2']=$_GET['filtre_stat_date2'];

			}
			
			//if ( ! isset($_GET['annuler_filtre']) && ! isset($_GET['filtrer']) && ! isset($_SESSION['filtre_bon_date']))


			//Création de la requete. Ne se trouve pas dans le test "Si frm poster" car si le user revient le filtre doit tj etre en place
			if (isset($_SESSION['filtre_stat_client']) && $_SESSION['filtre_stat_client'] != "" )
			{
				$filtre .= "client='"  . $_SESSION['filtre_stat_client'] . "' AND ";
			}
			if (isset($_SESSION['filtre_stat_date1']) && $_SESSION['filtre_stat_date1'] != "")
			{
				$filtre .= "date_fact" . saisie_to_sql($_SESSION['filtre_stat_date1'],"date") . " AND ";
			}
			if (isset($_SESSION['filtre_stat_date2']) && $_SESSION['filtre_stat_date2'] != "")
			{
				$filtre .= "date_fact" . saisie_to_sql($_SESSION['filtre_stat_date2'],"date") . " AND ";
			}


			
			if ($filtre != "")
			{
				$filtre = substr($filtre,0,strlen($filtre) -5); //retirer " AND " de la fin du filtre
				$sql .= " WHERE $filtre ";
			}
			//echo $filtre;

			// ----------------  FIN DE GESTION DES FILTRES  -----------------------------

			//echo $sql;

		?>
			<center>
			<table class="boiteaction" width="80%">
				<tr>
					<td width="40%">
						&nbsp;
					</td>
					<td width="5%">&nbsp;</td>
					<td width="60%">
						<?php //tableau de filtre ?>
						<form action="stat_toutes.php" method="get" name="frm_stat">
							<input type="hidden" name="filtrer"/>
							<table width="90%">
								<caption><?php aff_lang("Filtre") ?></caption>
								<tr>
									<td class="texte0" width="15%"><?php aff_lang("Client") ?></td>
									<td class="texte0" width="55%">
											<?php require_once("include/choix_cli.php");
													inclure_combo_client("filtre_stat_client",isset($_SESSION['filtre_stat_client'])?$_SESSION['filtre_stat_client']:"","frm_stat") ?>
									</td>
									<td class="submit" rowspan="4" width="15%">
										<br/>
										<input type="submit" value="Filtrer !"/>
										<br/><br/>
										<a href="stat_toutes.php?annuler_filtre=oui"><img border="0" src="image/delete.png" alt="<?php echo $lang_supprimer; ?>" /></a>
										<br/><br/>
										<?php bouton_aide("filtre") ?>
										<br/><br/>
									</td>
								</tr>
								<tr>
									<td class="texte0"><?php aff_lang("Date facture") ?></td>
									<td class="texte0">
										<input type="text" size="14" name="filtre_stat_date1" value="<?php echo isset($_SESSION['filtre_stat_date1'])?$_SESSION['filtre_stat_date1']:"" ?>" />
										<a href="#" onclick="window.open('include/pop.calendrier.php?frm=frm_stat&amp;ch=filtre_stat_date1','calendrier','width=415,height=190,left=200,top=200,scrollbars=0').focus();">
											<img src="image/petit_calendrier.gif" alt="calendrier" border="0"/>
										</a>
									</td>
								</tr>
								<tr>
									<td class="texte0"><?php aff_lang("Date facture") ?></td>
									<td class="texte0">
										<input type="text" size="14" name="filtre_stat_date2" value="<?php echo isset($_SESSION['filtre_stat_date2'])?$_SESSION['filtre_stat_date2']:"" ?>" />
										<a href="#" onclick="window.open('include/pop.calendrier.php?frm=frm_stat&amp;ch=filtre_stat_date2','calendrier','width=415,height=190,left=200,top=200,scrollbars=0').focus();">
											<img src="image/petit_calendrier.gif" alt="calendrier" border="0"/>
										</a>
									</td>
								</tr>
							</table>
						</form>

					</td>
				</tr>
			</table>

			</center>
		</td>
	</tr>

	<tr>
		<td>

			<?php
				//$filtre=$filtre_sans_prix;
		//um, lib, fournisseur, prix, DATE_FORMAT(date,'%d/%m/%Y') AS date
		//				FROM ${tblpref}depense";
		
				//somme des mois
				$sql_tot_mois="SELECT sum(total_fact_h)  as tot_mois, month(date_fact) as mois, year(date_fact) as annee FROM ($sql) as table_filtre 
						GROUP BY month(date_fact), year(date_fact) ORDER BY date_fact";
				$result_tot_mois=mysql_query( $sql_tot_mois ) or die("Erreur tot mois <br/>$sql_tot_mois<br/>" . mysql_error());
				//on stock dans un tableau pour les calculs des %
				while ($tot_mois=mysql_fetch_array($result_tot_mois))
				{
					$tab_tot_mois[$tot_mois['mois'] . $tot_mois['annee']] = $tot_mois['tot_mois'];
				}
				//echo $sql_tot_mois . "<br/>";

				//somme des clients
				$sql_tot_cli="SELECT sum(total_fact_h) as tot_cli,client FROM ($sql) as table_filtre GROUP BY client";
				$result_tot_cli=mysql_query( $sql_tot_cli ) or die("Erreur tot cli <br/>" . mysql_error());
				//on stock dans un tableau pour les calculs des %
				while ($tot_cli = mysql_fetch_array($result_tot_cli))
				{
					$tab_tot_cli[$tot_cli['client']] = $tot_cli['tot_cli'];
				}
				//print_r($tab_tot_four);
				//echo $sql_tot_four;

				$nb_col=mysql_num_rows($result_tot_mois) * 2 + 4; // utilisé pour les colspan
				//$nb_ligne=mysql_num_rows($result_tot_four) + 2;

				$sql_total_tout="SELECT sum(total_fact_h) as total FROM ($sql) as table_filtre ";
				$result_tout=mysql_query($sql_total_tout) or die("Erreur calcul total <br/>$sql_total_tout<br/>" . mysql_error());
				$total=mysql_result($result_tout,0); //contient le total générale

				$calendrier = calendrier_local_mois ();
			?>

		</td>
	</tr>


</table>

<?php // ---------   LE CHIFFRE D'AFFAIRE  ------------------- ?>

<center>
<table border="0" style="border:solid 3px">
	<caption>
		<?php aff_lang("Tableau de bord du Chiffre d'affaire") ?>
	</caption>

	<?php // affichage des mois ?>
	<tr>
		<td class="texte1" colspan="2" style="border-bottom:solid 2px">&nbsp;</td>
		<?php
		mysql_data_seek($result_tot_mois,0);
		while ($tot_mois=mysql_fetch_array($result_tot_mois))
		{
			?>
			<td class="texte1" style="text-align:center;border-right:dotted 1px;border-bottom:solid 2px;border-left:solid 1px">
				<?php echo utf8_decode(ucfirst($calendrier[$tot_mois['mois']])) . " " . substr($tot_mois['annee'],2,2) ?>
			</td>
			<?php $pourcent=$tab_tot_mois[$tot_mois['mois'] . $tot_mois['annee']] / $total * 100; ?>
			<td class="texte1" style="text-align:right;border-right:solid 1px;border-bottom:solid 2px;background-image:url(include/stat_image.php?hauteur=<?php echo $pourcent / 4 ?>);background-repeat:repeat-x;background-position:bottom;">
				<?php echo montant_taux($pourcent,0); ?>
			</td>
			<?php
			//$total=$total + $tot_mois['mois'];

		}
		?>
		<td>&nbsp;</td>
		<td class="texte1" style=";border:solid 1px"><?php aff_lang("Total") ?></td>
	</tr>

	<?php // boucle sur chaque fournisseur 
	$sql_cli = "SELECT DISTINCT client,nom FROM ($sql) as table_filtre ";
	$sql_cli.=" ORDER BY nom";
	$result_cli=mysql_query( $sql_cli ) or die("Erreur select cli <br/>$sql_cli<br/>" . mysql_error());

	while ($cli=mysql_fetch_array($result_cli))
	{
	?>
	<tr>
		<td class="texte1" style="border-right:dotted 1px;border-bottom:solid 1px;border-left:solid 1px">
			<?php $nom_client=$cli['nom'] ;$num_client=$cli['client']; echo $nom_client; ?>
		</td>
			<?php $pourcent=$tab_tot_cli[$num_client] / $total * 100; ?>
		<td class="texte1"  style="border-right:solid 1px;border-bottom:solid 1px;;background-image:url(include/stat_image.php?largeur=<?php echo $pourcent / 3 ?>);background-repeat:repeat-y;background-position:left;">
			<?php echo montant_taux($pourcent,0); ?>
		</td>
		<?php
		//boucle sur chaque mois
		mysql_data_seek($result_tot_mois,0);

		while ($tab_mois=mysql_fetch_array($result_tot_mois))
		{
			$mois=$tab_mois['mois'];
			$annee=$tab_mois['annee'];
			//somme pour ce mois pour ce fournisseur
			$sql_tot_cli_par_mois="SELECT sum(total_fact_h) as tot_cli_mois FROM ($sql) as table_filtre WHERE 
				client='$num_client' AND month(date_fact)=$mois AND year(date_fact)=$annee";

			//echo $sql_tot_four_par_mois . "<br/>";
			$result_cli_four_par_mois=mysql_query( $sql_tot_cli_par_mois ) or die("Erreur calcul tot four par mois <br/>$sql_tot_cli_par_mois<br/>" . mysql_error());
			
			$montant=mysql_result($result_cli_four_par_mois,0);

			?>
			<td class="texte0" style="text-align:right;border-right:dotted 1px;border-bottom:solid 1px;border-left:solid 1px">
				<?php echo montant_financier($montant); ?>
			</td>
			<td class="texte0" style="text-align:right;border-right:solid 1px;border-bottom:solid 1px;">
				<?php 
					if ($tab_tot_mois[$mois . $annee] == 0)
					{
						echo montant_taux(0,0);
					} else {
						echo montant_taux($montant / $tab_tot_mois[$mois . $annee] * 100,0); 
					}
					?>
			</td>

			<?php
		}
		?>

			<td>
				&nbsp;
			</td>

			<td class="totaltexte" style="text-align:right;border:solid 1px">
				<?php echo montant_financier($tab_tot_cli[$num_client]); ?>
			</td>

	</tr>
	<?php
	}

	?>

	<tr>
		<td colspan="<?php echo $nb_col ?>">
			
		</td>
	</tr>
	<?php // Affichage des totaux par mois ?>
	<tr>
		<td colspan="2" class="texte0" style="text-align:center;border:solid 1px;">Total</td>

		<?php
			foreach ($tab_tot_mois as $tot_mois)
			{
			?>
			<td class="totaltexte" style="text-align:center;border:solid 1px" colspan="2"><?php echo montant_financier($tot_mois) ?></td>
			<?php
			}
		?>
		<td>&nbsp;</td>
		<td class="totaltexte" style="text-align:right;border:solid 1px"><?php echo montant_financier($total) ?></td>
	</tr>

</table>

<br/><br/>

<?php // ---------   LES  ARTICLES  ------------------- ?>

<table border="0" style="border:solid 3px">
	<caption>
		<?php aff_lang("Tableau de bord des articles") ?>
	</caption>

	<?php 
		//somme des articles
		$sql_tot_art="SELECT sum(tot_art_htva) as tot_art,article_num FROM ($sql) as table_filtre 
				INNER JOIN ${tblpref}bon_comm ON num=num_facture 
				INNER JOIN ${tblpref}cont_bon ON num_bon=bon_num
				INNER JOIN ${tblpref}article ON article_num=${tblpref}article.num
				GROUP BY article_num";

		$result_tot_art=mysql_query( $sql_tot_art ) or die("Erreur tot art <br/>$sql_tot_art<br/>" . mysql_error());
		//on stock dans un tableau pour les calculs des %
		while ($tot_art = mysql_fetch_array($result_tot_art))
		{
			$tab_tot_art[$tot_art['article_num']] = $tot_art['tot_art'];
		}
		//print_r($tab_tot_art);
	 ?>
	<tr>
		<td class="texte1" colspan="2" style="border-bottom:solid 2px">&nbsp;</td>
		<?php
		mysql_data_seek($result_tot_mois,0);
		while ($tot_mois=mysql_fetch_array($result_tot_mois))
		{
			?>
			<td class="texte1" style="text-align:center;border-right:dotted 1px;border-bottom:solid 2px;border-left:solid 1px">
				<?php echo utf8_decode(ucfirst($calendrier[$tot_mois['mois']])) . " " . substr($tot_mois['annee'],2,2) ?>
			</td>
			<?php $pourcent=$tab_tot_mois[$tot_mois['mois'] . $tot_mois['annee']] / $total * 100; ?>
			<td class="texte1" style="text-align:right;border-right:solid 1px;border-bottom:solid 2px;background-image:url(include/stat_image.php?hauteur=<?php echo $pourcent / 4 ?>);background-repeat:repeat-x;background-position:bottom;">
				<?php echo montant_taux($pourcent,0); ?>
			</td>
			<?php
			//$total=$total + $tot_mois['mois'];

		}
		?>
		<td>&nbsp;</td>
		<td class="texte1" style=";border:solid 1px"><?php aff_lang("Total") ?></td>
	</tr>

	<?php // boucle sur chaque article 
	$sql_art = "SELECT DISTINCT article_num,article,prix_htva,taux_tva FROM ($sql) as table_filtre 
				INNER JOIN ${tblpref}bon_comm ON num=num_facture 
				INNER JOIN ${tblpref}cont_bon ON num_bon=bon_num
				INNER JOIN ${tblpref}article ON article_num=${tblpref}article.num
			ORDER BY prix_htva";
	$result_art=mysql_query( $sql_art ) or die("Erreur select art <br/>$sql_art<br/>" . mysql_error());

	while ($art=mysql_fetch_array($result_art))
	{
	?>
	<tr>
		<td class="texte1" style="border-right:dotted 1px;border-bottom:solid 1px;border-left:solid 1px">
			<?php 
					$num_article=$art['article_num']; 
					echo $art['article'] . " (" . montant_financier($art['prix_htva']) . 
						" / " . montant_financier($art['prix_htva'] + $art['prix_htva']*$art['taux_tva']/100) .
						" / " . montant_taux($art['taux_tva']) .")";
			?>
		</td>
			<?php $pourcent=$tab_tot_art[$num_article] / $total * 100; ?>
		<td class="texte1"  style="border-right:solid 1px;border-bottom:solid 1px;;background-image:url(include/stat_image.php?largeur=<?php echo $pourcent / 3 ?>);background-repeat:repeat-y;background-position:left;">
			<?php echo montant_taux($pourcent,0); ?>
		</td>
		<?php
		//boucle sur chaque mois
		mysql_data_seek($result_tot_mois,0);

		while ($tab_mois=mysql_fetch_array($result_tot_mois))
		{
			$mois=$tab_mois['mois'];
			$annee=$tab_mois['annee'];
			//somme pour ce mois pour ce fournisseur
			$sql_tot_art_par_mois="SELECT sum(tot_art_htva) as tot_art_mois FROM ($sql) as table_filtre 
				INNER JOIN ${tblpref}bon_comm ON num=num_facture 
				INNER JOIN ${tblpref}cont_bon ON num_bon=bon_num
				INNER JOIN ${tblpref}article ON article_num=${tblpref}article.num
				WHERE article_num='$num_article' AND month(date_fact)=$mois AND year(date_fact)=$annee";

			//echo $sql_tot_four_par_mois . "<br/>";
			$result_art_four_par_mois=mysql_query( $sql_tot_art_par_mois ) or die("Erreur calcul tot four par mois <br/>$sql_tot_art_par_mois<br/>" . mysql_error());
			
			$montant=mysql_result($result_art_four_par_mois,0);

			?>
			<td class="texte0" style="text-align:right;border-right:dotted 1px;border-bottom:solid 1px;border-left:solid 1px">
				<?php echo montant_financier($montant); ?>
			</td>
			<td class="texte0" style="text-align:right;border-right:solid 1px;border-bottom:solid 1px;">
				<?php 
					if ($tab_tot_mois[$mois . $annee] == 0)
					{
						echo montant_taux(0,0);
					} else {
						echo montant_taux($montant / $tab_tot_mois[$mois . $annee] * 100,0); 
					}
					?>
			</td>

			<?php
		}
		?>

			<td>
				&nbsp;
			</td>

			<td class="totaltexte" style="text-align:right;border:solid 1px">
				<?php echo montant_financier($tab_tot_art[$num_article]); ?>
			</td>

	</tr>
	<?php
	}

	?>

	<tr>
		<td colspan="<?php echo $nb_col ?>">
			
		</td>
	</tr>
	<?php // Affichage des totaux par mois ?>
	<tr>
		<td colspan="2" class="texte0" style="text-align:center;border:solid 1px;">Total</td>

		<?php
			foreach ($tab_tot_mois as $tot_mois)
			{
			?>
			<td class="totaltexte" style="text-align:center;border:solid 1px" colspan="2"><?php echo montant_financier($tot_mois) ?></td>
			<?php
			}
		?>
		<td>&nbsp;</td>
		<td class="totaltexte" style="text-align:right;border:solid 1px"><?php echo montant_financier($total) ?></td>
	</tr>

</table>

<br/><br/>

<?php // ---------   LA TVA  ------------------- ?>

<table border="0" style="border:solid 3px">
	<caption>
		<?php aff_lang("Tableau de bord de la TVA") ?>
	</caption>

	<?php 
		//somme des articles
		$sql_tot_tva="SELECT sum(tot_art_htva) as tot_tva,taux_tva FROM ($sql) as table_filtre 
				INNER JOIN ${tblpref}bon_comm ON num=num_facture 
				INNER JOIN ${tblpref}cont_bon ON num_bon=bon_num
				INNER JOIN ${tblpref}article ON article_num=${tblpref}article.num
				GROUP BY taux_tva";

		$result_tot_tva=mysql_query( $sql_tot_tva ) or die("Erreur tot art <br/>$sql_tot_tva<br/>" . mysql_error());
		//on stock dans un tableau pour les calculs des %
		while ($tot_tva = mysql_fetch_array($result_tot_tva))
		{
			$tab_tot_tva[$tot_tva['taux_tva']] = $tot_tva['tot_tva'];
		}
		//print_r($tab_tot_tva);
	 ?>
	<tr>
		<td class="texte1" colspan="2" style="border-bottom:solid 2px">&nbsp;</td>
		<?php
		mysql_data_seek($result_tot_mois,0);
		while ($tot_mois=mysql_fetch_array($result_tot_mois))
		{
			?>
			<td class="texte1" style="text-align:center;border-right:dotted 1px;border-bottom:solid 2px;border-left:solid 1px">
				<?php echo utf8_decode(ucfirst($calendrier[$tot_mois['mois']])) . " " . substr($tot_mois['annee'],2,2) ?>
			</td>
			<?php $pourcent=$tab_tot_mois[$tot_mois['mois'] . $tot_mois['annee']] / $total * 100; ?>
			<td class="texte1" style="text-align:right;border-right:solid 1px;border-bottom:solid 2px;background-image:url(include/stat_image.php?hauteur=<?php echo $pourcent / 4 ?>);background-repeat:repeat-x;background-position:bottom;">
				<?php echo montant_taux($pourcent,0); ?>
			</td>
			<?php
			//$total=$total + $tot_mois['mois'];

		}
		?>
		<td>&nbsp;</td>
		<td class="texte1" style=";border:solid 1px"><?php aff_lang("Total") ?></td>
	</tr>

	<?php // boucle sur chaque tva 
	foreach ($tab_tot_tva as $taux_tva => $montant_tva)
	{
	?>
	<tr>
		<td class="texte1" style="border-right:dotted 1px;border-bottom:solid 1px;border-left:solid 1px">
			<?php echo montant_taux($taux_tva); ?>
		</td>
			<?php $pourcent=$montant_tva / $total * 100; ?>
		<td class="texte1"  style="border-right:solid 1px;border-bottom:solid 1px;;background-image:url(include/stat_image.php?largeur=<?php echo $pourcent / 3 ?>);background-repeat:repeat-y;background-position:left;">
			<?php echo montant_taux($pourcent,0); ?>
		</td>
		<?php
		//boucle sur chaque mois
		mysql_data_seek($result_tot_mois,0);

		while ($tab_mois=mysql_fetch_array($result_tot_mois))
		{
			$mois=$tab_mois['mois'];
			$annee=$tab_mois['annee'];
			//somme pour ce mois pour ce fournisseur
			$sql_tot_tva_par_mois="SELECT sum(tot_art_htva) as tot_art_mois FROM ($sql) as table_filtre 
				INNER JOIN ${tblpref}bon_comm ON num=num_facture 
				INNER JOIN ${tblpref}cont_bon ON num_bon=bon_num
				INNER JOIN ${tblpref}article ON article_num=${tblpref}article.num
				WHERE taux_tva=$taux_tva AND month(date_fact)=$mois AND year(date_fact)=$annee";

			//echo $sql_tot_tva_par_mois . "<br/>";
			$result_tva_four_par_mois=mysql_query( $sql_tot_tva_par_mois ) or die("Erreur calcul tot four par mois <br/>$sql_tot_tva_par_mois<br/>" . mysql_error());
			
			$montant=mysql_result($result_tva_four_par_mois,0);

			?>
			<td class="texte0" style="text-align:right;border-right:dotted 1px;border-bottom:solid 1px;border-left:solid 1px">
				<?php echo montant_financier($montant); ?>
			</td>
			<td class="texte0" style="text-align:right;border-right:solid 1px;border-bottom:solid 1px;">
				<?php 
					if ($tab_tot_mois[$mois . $annee] == 0)
					{
						echo montant_taux(0,0);
					} else {
						echo montant_taux($montant / $tab_tot_mois[$mois . $annee] * 100,0); 
					}
					?>
			</td>

			<?php
		}
		?>

			<td>
				&nbsp;
			</td>

			<td class="totaltexte" style="text-align:right;border:solid 1px">
				<?php echo montant_financier($montant_tva); ?>
			</td>

	</tr>
	<?php
	}

	?>

	<tr>
		<td colspan="<?php echo $nb_col ?>">
			
		</td>
	</tr>
	<?php // Affichage des totaux par mois ?>
	<tr>
		<td colspan="2" class="texte0" style="text-align:center;border:solid 1px;">Total</td>

		<?php
			foreach ($tab_tot_mois as $tot_mois)
			{
			?>
			<td class="totaltexte" style="text-align:center;border:solid 1px" colspan="2"><?php echo montant_financier($tot_mois) ?></td>
			<?php
			}
		?>
		<td>&nbsp;</td>
		<td class="totaltexte" style="text-align:right;border:solid 1px"><?php echo montant_financier($total) ?></td>
	</tr>




</table>




</center>

<br/>

<hr/>

<br/>

</body>
</html>

